package top.stmo.blog.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import top.stmo.blog.admin.pojo.Admin;
import top.stmo.blog.admin.pojo.Permission;

import java.util.List;

@Repository
public interface AdminMapper extends BaseMapper<Admin> {

    @Select("SELECT * FROM `permission` WHERE id \n" +
            "IN(SELECT `permission_id` FROM `admin_permission` \n" +
            "WHERE `admin_id` = #{adminId})")
    List<Permission> findPermissionByAdminId(Long adminId);
}
